

export default function createResponse(xhr){

    let arr = xhr.getAllResponseHeaders().split('\r\n');
    let headers = {};

    arr.forEach(item=>{
        if(!item){
            return;
        }

        let [key ,val] = item.split(': ');

        headers[key] = val;
    })

    return {
        ok:true,
        status:xhr.status,
        statusText:xhr.statusText,
        data:xhr.response,
        headers
    }
}